package edu.towson.greenteam;

import edu.towson.greenteam.command.CMDGetTables;
import edu.towson.greenteam.command.CMDAddComment;
import edu.towson.greenteam.command.CMDAddItemRating;
import edu.towson.greenteam.command.CMDAddMenuItem;
import edu.towson.greenteam.command.CMDAddOffer;
import edu.towson.greenteam.command.CMDGetComments;
import edu.towson.greenteam.command.CMDGetMenu;
import edu.towson.greenteam.command.CMDGetOrders;
import edu.towson.greenteam.command.CMDMenuByPrice;
import edu.towson.greenteam.command.CMDMenuByRating;
import edu.towson.greenteam.command.CMDPlaceOrder;
import edu.towson.greenteam.command.CMDSetMenuItemQuantity;
import edu.towson.greenteam.comment.Comments;
import edu.towson.greenteam.menu.Category;
import edu.towson.greenteam.menu.Menu;
import edu.towson.greenteam.menu.MenuItem;
import edu.towson.greenteam.order.Order;
import edu.towson.greenteam.order.Orders;
import edu.towson.greenteam.tab.Tabs;
import edu.towson.greenteam.table.Tables;
import edu.towson.greenteam.table.Table;

public class Invoker {

    InformationAggregator ia;

    public Invoker() {
        ia = new InformationAggregator();
    }

    public Menu getMenu() {
        CMDGetMenu cmd = new CMDGetMenu(ia);
        return (Menu) cmd.execute();
    }

    public Menu getMenuByPrice(int price) {
        CMDMenuByPrice cmd = new CMDMenuByPrice(ia, price);
        return (Menu) cmd.execute();
    }

    public Menu getMenuByRating(int rating) {
        CMDMenuByRating cmd = new CMDMenuByRating(ia, rating);
        return (Menu) cmd.execute();
    }

    public Menu addMenuItem(String name, String description, float price, int maxQty,
            Category category, int prepTime) {
        CMDAddMenuItem cmd = new CMDAddMenuItem(ia, name, description, price, maxQty,
                category, prepTime);
        return (Menu) cmd.execute();
    }

    public Comments getComments() {
    	CMDGetComments cmd = new CMDGetComments(ia);
        return (Comments) cmd.execute();
    }

    public Object addComment(String comment, String custname) {
        CMDAddComment cmd = new CMDAddComment(ia, comment, custname);
        return cmd.execute();
    }
    
    public Tabs getTabs() {
    	return ia.getTabs();
    }

    public Orders getOrders() {
        CMDGetOrders cmd = new CMDGetOrders(ia);
        return (Orders) cmd.execute();
    }

    public void setOrderServed(Order o) {
    }

    public Object setMenuItemQuantity(int id, int quantity) {
        CMDSetMenuItemQuantity cmd = new CMDSetMenuItemQuantity(ia, id, quantity);
        return (Boolean) cmd.execute();
    }

    public Object addOffer(String name, String description, int percentDiscount, float minTabValue) {
        CMDAddOffer cmd = new CMDAddOffer(ia, name, description, percentDiscount, minTabValue);
        return (Boolean) cmd.execute();
    }

    public void applyOfferToTab() {
    }

    public String getKitchenQueue() {
        return null;
    }

    public String getOccupiedTables() {
        return null;
    }
    
    public Object placeOrder(MenuItem mi, Table tbl) {
    	CMDPlaceOrder cmd = new CMDPlaceOrder(ia, mi, tbl);
    	return cmd.execute();
    }

    public String getTablesWaitingOnFoodOrder() {
        return null;
    }

    public void setPin(int pin) {
    }

    public String getTable() {
        return null;
    }

    public Object addItemRating(int id, int rating) {
        CMDAddItemRating cmd = new CMDAddItemRating(ia, id, rating);
        return (Boolean) cmd.execute();
    }

    public void setTabPayment() {
    }

    public Tables getTables() {
        CMDGetTables cmd = new CMDGetTables(ia);
        return (Tables) cmd.execute();
    }
}
